Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sign manifests asynchronously #1265

Merged
merged 1 commit into from
Nov 1, 2023
Merged

Conversation

lubosmj
Copy link
Member

@lubosmj lubosmj commented Apr 17, 2023

closes #1208

@lubosmj lubosmj force-pushed the asynchronous-signing-1208 branch 9 times, most recently from 11f03e7 to 61a8af4 Compare April 17, 2023 12:40
manifest_file.write(artifact.file.read())
manifest_file.flush()
async with tempfile.NamedTemporaryFile(dir=".", mode="wb", delete=False) as tf:
await tf.write(artifact.file.read())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
await tf.write(artifact.file.read())
await tf.write(await sync_to_async(artifact.file.read)())

This should probably not be blocking...

Copy link
Member Author

@lubosmj lubosmj May 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on your latest comment, I am reverting the suggested change:
#1285 (comment)

Can you sign this off?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to understand what i meant back then. I still think that django storages does not yet know about async. So "artifact.file.read" (which is probably a blocking call,) should not be called from an async context directly, but sync_to_async as i suggested.

@lubosmj lubosmj force-pushed the asynchronous-signing-1208 branch from af0bd00 to 5924150 Compare April 20, 2023 22:25
@lubosmj
Copy link
Member Author

lubosmj commented Apr 20, 2023

I cannot really test the changes locally because of multiple permission errors in oci_env. Is someone with a vagrant box volunteering to test the changes? Or, do we trust our CI tests?

@lubosmj lubosmj marked this pull request as ready for review April 20, 2023 22:42
@ipanova
Copy link
Member

ipanova commented Apr 21, 2023

I can test, my vagrant box seems to be alive.

@ipanova ipanova self-requested a review April 21, 2023 08:32
@lubosmj lubosmj force-pushed the asynchronous-signing-1208 branch 2 times, most recently from ef0872c to 119a70b Compare May 17, 2023 17:13
@ipanova
Copy link
Member

ipanova commented Jul 25, 2023

can you update this line https://github.com/pulp/pulp_container/pull/1265/files#diff-94c6436dad7eb9a689d63e5b6e6ceb0d18ddac41ce565c1aa91313c1be8ccfc2R35 we sign manifest lists and children manifests are signed by tag too

@lubosmj lubosmj force-pushed the asynchronous-signing-1208 branch 2 times, most recently from 37633fa to ddc64d3 Compare July 25, 2023 17:31
@stale
Copy link

stale bot commented Oct 24, 2023

This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!

@stale stale bot added the stale label Oct 24, 2023
@lubosmj lubosmj force-pushed the asynchronous-signing-1208 branch from ddc64d3 to 4cd7531 Compare October 31, 2023 11:45
@stale
Copy link

stale bot commented Oct 31, 2023

This pull request is no longer marked for closure.

@stale stale bot removed the stale label Oct 31, 2023

from aiofiles import tempfile
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh... That name is a bit deceiving. But ok.

added_signatures.append(signature_pk)
if tagged_manifest.media_type in MANIFEST_MEDIA_TYPES.LIST:
# parse ML and sign per-arches
added_signatures = []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you clearing that list here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should not. Oopsie woopsie. 👀

manifest_file.write(artifact.file.read())
manifest_file.flush()
async with tempfile.NamedTemporaryFile(dir=".", mode="wb", delete=False) as tf:
await tf.write(artifact.file.read())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to understand what i meant back then. I still think that django storages does not yet know about async. So "artifact.file.read" (which is probably a blocking call,) should not be called from an async context directly, but sync_to_async as i suggested.

@lubosmj lubosmj force-pushed the asynchronous-signing-1208 branch from 4cd7531 to 46076ba Compare October 31, 2023 13:45
@@ -19,6 +20,10 @@
SIGNATURE_TYPE,
)

SIGNING_TASKS_COUNTER = 10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we expose this to the settings so it is configurable?
I know, this PR then won't be backportable, which is ok given that we don't have now any BZs opened and if we will then backporting without the settings is always an option.

Copy link
Member

@ipanova ipanova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, i left a suggestion to expose the setting. in that case should probably rename it because counter is misleading.

@mdellweg
Copy link
Member

lgtm, i left a suggestion to expose the setting. in that case should probably rename it because counter is misleading.

"MAX_PARALLEL_..."

@lubosmj lubosmj force-pushed the asynchronous-signing-1208 branch from 46076ba to 761434b Compare October 31, 2023 16:30
Copy link
Member

@ipanova ipanova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@lubosmj lubosmj merged commit 18a5083 into pulp:main Nov 1, 2023
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sign manifests concurrently
3 participants